import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router);
const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
	if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
	return originalPush.call(this, location).catch(err => err)
}

export default new Router({
	routes: [{
			path: '/',
			name: 'Index',
			component: () => import('@/views/Version.vue'),
		},
		{
			path: '/version',
			name: 'Version',
			component: () => import('@/views/Version.vue'),
		},
		{
			path: '/item',
			name: 'Item',
			component: () => import('@/views/Item.vue'),
		},
		{
			path: '/building',
			name: 'Building',
			component: () => import('@/views/Building.vue'),
		},
		{
			path: '/recipe',
			name: 'Recipe',
			component: () => import('@/views/Recipe.vue'),
		},
		{
			path: '/type/item',
			name: 'itemType',
			component: () => import('@/views/ItemType.vue'),
		},
		{
			path: '/type/building',
			name: 'buildType',
			component: () => import('@/views/BuildType.vue'),
		},
		{
			path: '/item/info',
			name: "ItemInfo",
			component: () => import('@/views/ItemInfo.vue'),
		},
		{
			path: '/build/info',
			name: "BuildInfo",
			component: () => import('@/views/BuildInfo.vue'),
		}
	]
})